/* components */
import BizTable from '@src/component/business/BizTable/BizTable.tsx'
import BaseSearchDrawer from 'packages/BaseSearchDrawer/BaseSearchDrawer.vue'
import BaseSearchPanel from 'packages/BaseSearchPanel'
import AdvancedSearch from '@src/component/AdvancedSearch/index.vue';
/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
/* vue */
import { Component, Emit, Prop, Ref } from 'vue-property-decorator'
import { CreateElement } from 'vue'
/* render */
import BizListViewRender from '@src/component/business/BizListView/BizListViewRender.tsx'
/* scss */
import '@src/component/business/BizListView/BizListView.scss'

@Component({
  name: ComponentNameEnum.BizListView,
  components: {
    AdvancedSearch,
    [BaseSearchDrawer.name]: BaseSearchDrawer,
    [BaseSearchPanel.name]: BaseSearchPanel,
    BizTable
  }
})
export default class BizListView<T, P> extends BizListViewRender<T, P> {
  
  async created() {
    if(this.pageSizeStorageKey !== 'empty') {
      // 读取列表pageSize
      const pageSizeJson:any = await this.getDataWithStorage(this.pageSizeStorageKey, {'pageSize': 10})
      try {
        const { pageSize = 10 } = JSON.parse(pageSizeJson)
        this.searchParams.pageSize = pageSize
      } catch (error) {
        
      }
    }
  }
  
  render(h: CreateElement) {
    const attrs = this.getAttributes()
    
    return (
      <div {...attrs}>
        { this.renderHeaderContainer() }
        { this.renderOperationContainer() }
        { this.renderContentContainer() }
        { this.renderComponentsContainer() }
      </div>
    )
  }
  
}

